Develop#9
Merged
Merged
Conversation
…eation and password change, and update UserApplicationService with async methods for user operations
…tration and password change; improve mapping configurations for user roles and authorities
There was a problem hiding this comment.
Pull request overview
This PR appears to extend the identity service with initial “account/user” application APIs (register/profile/password change), expands the User creation domain event payload, and relocates token-grant DTOs into the application layer.
Changes:
- Added
UserApplicationServiceAPIs and anAccountControllerwith endpoints for registration, profile retrieval, and password change. - Updated domain user creation to accept nickname/email/phone and emit an expanded
UserCreatedEvent. - Moved
TokenGrantRequestDto/TokenGrantResponseDtousage frominterfaces.dtotoapplication.dto, updating controllers/services accordingly.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| identity/src/main/java/io/theurl/identity/persistence/repository/UserRepositoryImpl.java | Adds JPA EntityManager injection and modifies findByAnyOf mapping logic. |
| identity/src/main/java/io/theurl/identity/persistence/query/UserDetailQuery.java | Introduces a mediator query type for user profile details. |
| identity/src/main/java/io/theurl/identity/persistence/profile/UserMapProfile.java | Expands ModelMapper mappings/providers for User, UserRole, and UserAuthority. |
| identity/src/main/java/io/theurl/identity/persistence/model/UserDetail.java | Adds a persistence model intended for profile/detail reads. |
| identity/src/main/java/io/theurl/identity/interfaces/controller/UserController.java | Adds a controller scaffold wired to UserApplicationService. |
| identity/src/main/java/io/theurl/identity/interfaces/controller/AuthController.java | Updates imports to use application-layer token DTOs. |
| identity/src/main/java/io/theurl/identity/interfaces/controller/AccountController.java | Adds account endpoints (register/profile/password change). |
| identity/src/main/java/io/theurl/identity/domain/event/UserUnlockedEvent.java | Makes the event class final and removes a no-op override. |
| identity/src/main/java/io/theurl/identity/domain/event/UserCreatedEvent.java | Expands event payload fields and switches to Lombok constructor generation. |
| identity/src/main/java/io/theurl/identity/domain/aggregate/User.java | Updates User.create(...) signature and raises expanded UserCreatedEvent. |
| identity/src/main/java/io/theurl/identity/application/implement/UserApplicationServiceImpl.java | Implements create/profile/password-change orchestration via mediator. |
| identity/src/main/java/io/theurl/identity/application/implement/AuthApplicationServiceImpl.java | Updates imports to use application-layer token DTOs. |
| identity/src/main/java/io/theurl/identity/application/handler/UserCreateCommandHandler.java | Uses the updated User.create(...) API. |
| identity/src/main/java/io/theurl/identity/application/dto/UserProfileResponseDto.java | Adds a response DTO placeholder for profile API. |
| identity/src/main/java/io/theurl/identity/application/dto/UserPasswordChangeRequestDto.java | Adds DTO for password change requests. |
| identity/src/main/java/io/theurl/identity/application/dto/UserCreateRequestDto.java | Adds DTO for user creation requests. |
| identity/src/main/java/io/theurl/identity/application/dto/TokenGrantResponseDto.java | Changes package to application.dto. |
| identity/src/main/java/io/theurl/identity/application/dto/TokenGrantRequestDto.java | Changes package to application.dto. |
| identity/src/main/java/io/theurl/identity/application/contract/UserApplicationService.java | Defines async user APIs (create/profile/password change). |
| identity/src/main/java/io/theurl/identity/application/contract/AuthApplicationService.java | Updates imports to use application-layer token DTOs. |
| framework/src/main/java/io/theurl/framework/configure/MediatorConfiguration.java | Minor refactor of async event publishing lambda. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
72
to
+76
| return repository.findByAnyOf(username, email, phone) | ||
| .map(entity -> mapper.map(entity, User.class)) | ||
| .map(entity ->{ | ||
| System.out.println(entity); | ||
| return mapper.map(entity, User.class); | ||
| }) |
Comment on lines
+19
to
+20
| @PersistenceContext | ||
| private EntityManager context; |
Comment on lines
+38
to
+41
| public CompletableFuture<UserProfileResponseDto> getProfileAsync() { | ||
| var query = new UserDetailQuery(1L); | ||
| return mediator.executeAsync(query) | ||
| .thenApply(userDetail -> mapper.map(userDetail, UserProfileResponseDto.class)); |
|
|
||
| @Override | ||
| public CompletableFuture<Void> changePasswordAsync(String oldPassword, String newPassword) { | ||
| mediator.executeAsync(new UserAuthInfoQuery("id", "")) |
Comment on lines
+62
to
+63
| var command = new UserPasswordChangeCommand(1L, newPassword, "change"); | ||
| return mediator.sendAsync(command); |
| if (phone != null && !phone.isEmpty()) { | ||
| user.setPhone(phone); | ||
| } | ||
| user.raiseEvent(new UserCreatedEvent(username, nickname, email, phone)); |
| @@ -0,0 +1,4 @@ | |||
| package io.theurl.identity.persistence.model; | |||
|
|
|||
| public class UserDetail { | |||
Comment on lines
+2
to
+3
|
|
||
| public class UserProfileResponseDto { |
Comment on lines
+3
to
+20
| import io.theurl.identity.application.contract.UserApplicationService; | ||
| import io.theurl.identity.application.dto.UserCreateRequestDto; | ||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.web.bind.annotation.PostMapping; | ||
| import org.springframework.web.bind.annotation.RequestBody; | ||
| import org.springframework.web.bind.annotation.RequestMapping; | ||
| import org.springframework.web.bind.annotation.RestController; | ||
|
|
||
| @RestController | ||
| @RequestMapping("user") | ||
| public class UserController { | ||
| private final UserApplicationService service; | ||
|
|
||
| public UserController(UserApplicationService service) { | ||
| this.service = service; | ||
| } | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.